<template>
	<view>
		<nav-bar   fontColor="#FFFFFF" title="抢单详情页"></nav-bar>
		<uni-card mode="basic">
			<view class="title">公司名称：{{shippingData.customerName == null ? '暂无数据' : shippingData.customerName}}</view>
			<!-- <view class="title">公司编号： {{shippingData.customerNo  == null ? '暂无数据' : shippingData.customerNo}}</view> -->
			<view class="title">物品名称： {{shippingData.materialName}}</view>
			<view class="title">库位编号： {{shippingData.locationNo}}</view>
			<view class="title">操作员： {{shippingData.pickUpUserName}}</view>
			<view class="title">操作员编号： {{shippingData.pickUpUserNo}}</view>
			<view class="title">状态： {{shippingData.status == 'created' ? '创建' : '其他'}}</view>
			<view class="title">日期： {{shippingData.createTime}}</view>
		</uni-card>
		<!-- <uni-card mode="basic" title="上架任务明细">
			<view v-for="(item,index) in getDataList">
				<uni-list>
					<uni-list-item :index="index+1"
						:title="'物品名称:'+item.materialName + '\n库位编号:'+item.locationNo"
						:note="'操作员:'+item.jobUserName + '\n'+ '日期:'+item.requstRecptDate" link="reLaunch"
						clickable>
					</uni-list-item>
				</uni-list>
			</view>
		</uni-card> -->
		<view style="height: 120rpx;">
			<button @click="submit" style="width: 90%;margin: 0 auto;left:0;right:0;background: #3B5DE0;color: #FFFFFF;margin-top: 20rpx;z-index: 999;position: fixed;bottom: 20rpx;">抢单</button>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				shippingData:{},
				getDataList:[]
			}
		},
		onLoad(e) {
			console.log(JSON.parse(e.id))
			this.shippingData = JSON.parse(e.id)
			let opt = {
				url:'web/tWmsReciptIntoLocPlan/search',
				method:'POST'
			};
			let params = {
				reciptLineId: this.shippingData.id
			};
			this.$http.httpTokenRequest(opt,params).then(res => {
				this.getDataList = res.data.data
			})
		},
		methods:{
			submit(){
				let opt = {
					url:'web/tWmsReciptIntoLocPlan/getInlocJob',
					method:'POST'
				};
				let params = {
					ids:[this.shippingData.id]
				};
				this.$http.httpTokenRequest(opt,params).then(res => {
					if(res.data.code == 200){
						uni.showToast({
							title:'抢单成功',
							icon:'success',
							position:'center',
							duration:2000
						});
						setTimeout(()=>{
							uni.navigateBack({
								delta: 1
							})
						},2000)
					}
					else{
						uni.showToast({
							title: res.data.msg,
							icon:'error',
							position:'center',
							duration:2000
						});
					}
				})
			}
		}
	}
</script>

<style>
	.title{
		margin: 20rpx 0;
	}
</style>